/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.ui.rich.postp.postp_view.dialog;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder;

import br.ufmg.dees.insane.commons.view.ViewState;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.DesktopPostp;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.InterfacePostp;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.PostpViewState;
import br.ufmg.dees.insane.ui.rich.postp.postp_view.VertexViewState;

/**
 *
 * @author  Samuel Silva Penna
 */
public class VerticesSettingsDialog extends javax.swing.JDialog {
    
//	 Variables declaration - do not modify                     
    private JButton verticesColorChooseButton;
    private JButton verticesStateColorChooseButton;
    private JButton viewButton;
    private JButton cancelButton;
    private JButton okButton;
    private JButton fontColorChooseButton;
    private JCheckBox labelOnCheckBox;
    private JCheckBox labelOffCheckBox;
    private JCheckBox allWindowsCheckBox;
    private JCheckBox selectedWindowCheckBox;
    private JCheckBox coordsOnCheckBox;
    private JCheckBox coordsOffCheckBox;
    private JComboBox fontComboBox;
    private JComboBox fontSizeComboBox;
    private JLabel jLabel1;
    private JLabel jLabel2;
    private JLabel jLabel4;
    private JLabel jLabel5;
    private JLabel jLabel6;
    private JLabel jLabel7;
    private JLabel jLabel9;
    private JPanel labelSettingsPanel;
    private JPanel verticesPanel;
    private JPanel verticesStatePanel;
    private JRadioButton plainRadioButton;
    private JRadioButton italicRadioButton;
    private JRadioButton boldRadioButton;
    private JTextField markSizeTextField;
    private JTextField verticesColorField;
    private JTextField markStateSizeTextField;
    private JTextField verticesStateColorField;
    private JTextField fontColorField;
    // End of variables declaration                   
	
    private DesktopPostp desktop;
	private PostpViewState state;
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/** Creates new form VerticesSettingsDialog */
    public VerticesSettingsDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }
    
    /** Creates new form FaceSettingsDialog */
	public VerticesSettingsDialog(ViewState vs,Frame parent, boolean modal) {
		super(parent, modal);
		this.state = (PostpViewState)vs;
		initComponents();
	}
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
		this.setSize(new Dimension(475,355));
		this.setPreferredSize(new Dimension(475,355));
		this.setMaximumSize(new Dimension(475,355));
		this.setMinimumSize(new Dimension(475,355));
		
		this.setResizable(false);
		this.setTitle("Vertices Settings Dialogs");
		this.setLocationRelativeTo(this.desktop);
		//Image ico = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("br/ufmg/dees/insane/images/Insane64.gif"));
		//this.setIconImage(ico);
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    	
        labelSettingsPanel = new JPanel();
        jLabel1 = new JLabel();
        jLabel2 = new JLabel();
        fontComboBox = new JComboBox();
        fontSizeComboBox = new JComboBox();
        plainRadioButton = new JRadioButton();
        italicRadioButton = new JRadioButton();
        boldRadioButton = new JRadioButton();
        labelOnCheckBox = new JCheckBox();
        labelOffCheckBox = new JCheckBox();
        fontColorField = new JTextField();
        fontColorChooseButton = new JButton();
        jLabel9 = new JLabel();
        coordsOnCheckBox = new JCheckBox();
        coordsOffCheckBox = new JCheckBox();
        verticesPanel = new JPanel();
        jLabel4 = new JLabel();
        jLabel5 = new JLabel();
        markSizeTextField = new JTextField();
        verticesColorChooseButton = new JButton();
        verticesColorField = new JTextField();
        allWindowsCheckBox = new JCheckBox();
        selectedWindowCheckBox = new JCheckBox();
        viewButton = new JButton();
        okButton = new JButton();
        cancelButton = new JButton();
        verticesStatePanel = new JPanel();
        jLabel6 = new JLabel();
        jLabel7 = new JLabel();
        markStateSizeTextField = new JTextField();
        verticesStateColorChooseButton = new JButton();
        verticesStateColorField = new JTextField();

        getContentPane().setLayout(null);
       
        //Label SettingsPanel
        labelSettingsPanel.setLayout(null);
        labelSettingsPanel.setBorder(BorderFactory.createTitledBorder(null, "Label Settings", TitledBorder.DEFAULT_JUSTIFICATION,
        		TitledBorder.DEFAULT_POSITION, new Font("Arial", 0, 11)));
       
        jLabel1.setText("Font");
        jLabel1.setFont(new Font("Arial", 0, 11));
        labelSettingsPanel.add(jLabel1);
        jLabel1.setBounds(10, 20, 22, 25);

        fontComboBox.setModel(new DefaultComboBoxModel(new String[] { "Arial", "Monospaced", "SansSerif", "Time" }));
        fontComboBox.setSelectedItem(this.state.getVertexViewState().getTextFont());
        fontComboBox.setFont(new Font("Arial", 0, 12));
        labelSettingsPanel.add(fontComboBox);
        fontComboBox.setBounds(40, 20, 140, 25);

        jLabel2.setText("Size");
        jLabel2.setFont(new Font("Arial", 0, 11));
        labelSettingsPanel.add(jLabel2);
        jLabel2.setBounds(210, 20, 40, 25);
        
        fontSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"2","4","6","8","10","12","16","18"}));
        fontSizeComboBox.setSelectedItem(this.state.getVertexViewState().getTextSize()+"");
		fontSizeComboBox.setFont(new Font("Arial", Font.PLAIN, 12));
		fontSizeComboBox.setEditable(true);
        labelSettingsPanel.add(fontSizeComboBox);
        fontSizeComboBox.setBounds(250, 20, 80, 25);

        plainRadioButton.setText("Plain");
		plainRadioButton.setFont(new Font("Arial", Font.PLAIN, 11));
		plainRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		plainRadioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(plainRadioButton.isSelected()){
					boldRadioButton.setSelected(false);
				}else{
					boldRadioButton.setSelected(true);
				}
			}
		} );
		plainRadioButton.setMargin(new Insets(0, 0, 0, 0));
		labelSettingsPanel.add(plainRadioButton);
		plainRadioButton.setBounds(10, 60, 50, 20);
          
		italicRadioButton.setText("Italic");
		italicRadioButton.setFont(new Font("Arial", Font.PLAIN, 11));
		italicRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		italicRadioButton.setMargin(new Insets(0, 0, 0, 0));
		labelSettingsPanel.add(italicRadioButton);
		italicRadioButton.setBounds(65, 60, 50, 20);

		boldRadioButton.setText("Bold");
		boldRadioButton.setFont(new Font("Arial", Font.PLAIN, 11));
		boldRadioButton.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		boldRadioButton.setMargin(new Insets(0, 0, 0, 0));
		boldRadioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(boldRadioButton.isSelected()){
					plainRadioButton.setSelected(false);
				}else{
					plainRadioButton.setSelected(true);
				}
			}
		} );
		labelSettingsPanel.add(boldRadioButton);
		boldRadioButton.setBounds(140, 60, 40, 20);

		if(this.state.getVertexViewState().getTextStyle()==0){
			plainRadioButton.setSelected(true);
			boldRadioButton.setSelected(false);
			italicRadioButton.setSelected(false);
		}
		if(this.state.getVertexViewState().getTextStyle()==1){
			plainRadioButton.setSelected(false);
			boldRadioButton.setSelected(true);
			italicRadioButton.setSelected(false);
		}
		if(this.state.getVertexViewState().getTextStyle()==2){
			plainRadioButton.setSelected(true);
			boldRadioButton.setSelected(false);
			italicRadioButton.setSelected(true);
		}
		if(this.state.getVertexViewState().getTextStyle()==3){
			plainRadioButton.setSelected(false);
			boldRadioButton.setSelected(true);
			italicRadioButton.setSelected(true);
		}
		
		labelOnCheckBox.setText("Label On");
		labelOnCheckBox.setFont(new Font("Arial", Font.PLAIN, 11));
		labelOnCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		labelOnCheckBox.setMargin(new Insets(0, 0, 0, 0));
		labelOnCheckBox.setSelected(this.state.getVertexViewState().isLabelOn());
		labelOnCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(labelOnCheckBox.isSelected()){
					labelOffCheckBox.setSelected(false);
				}else{
					labelOffCheckBox.setSelected(true);
				}
			}
		} );
		labelSettingsPanel.add(labelOnCheckBox);
		labelOnCheckBox.setBounds(255, 70, 70, 20);
		
		labelOffCheckBox.setText("Label Off");
		labelOffCheckBox.setFont(new Font("Arial", Font.PLAIN, 11));
		labelOffCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
		labelOffCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
		labelOffCheckBox.setSelected(!this.state.getVertexViewState().isLabelOn());
		labelOffCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(labelOffCheckBox.isSelected()){
					labelOnCheckBox.setSelected(false);
				}else{
					labelOnCheckBox.setSelected(true);
				}
			}
		} );
		labelSettingsPanel.add(labelOffCheckBox);
        labelOffCheckBox.setBounds(345, 70, 70, 20);
        
        coordsOnCheckBox.setText("Coords On");
        coordsOnCheckBox.setFont(new Font("Arial", Font.PLAIN, 11));
        coordsOnCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        coordsOnCheckBox.setMargin(new Insets(0, 0, 0, 0));
		coordsOnCheckBox.setSelected(this.state.getVertexViewState().isCoordsOn());
        coordsOnCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(coordsOnCheckBox.isSelected()){
					coordsOffCheckBox.setSelected(false);
				}else{
					coordsOffCheckBox.setSelected(true);
				}
			}
		} );
		labelSettingsPanel.add(coordsOnCheckBox);
		coordsOnCheckBox.setBounds(255, 100, 70, 20);

		coordsOffCheckBox.setText("Coords Off");
		coordsOffCheckBox.setFont(new Font("Arial", Font.PLAIN, 11));
		coordsOffCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		coordsOffCheckBox.setMargin(new Insets(0, 0, 0, 0));
		coordsOffCheckBox.setSelected(!this.state.getVertexViewState().isCoordsOn());
		coordsOffCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(coordsOffCheckBox.isSelected()){
					coordsOnCheckBox.setSelected(false);
				}else{
					coordsOnCheckBox.setSelected(true);
				}
			}
		} );
        labelSettingsPanel.add(coordsOffCheckBox);
        coordsOffCheckBox.setBounds(345, 100, 75, 20);
        
        fontColorField.setText("");
        fontColorField.setEditable(false);
        fontColorField.setBackground(this.state.getVertexViewState().getLabelColor());
        labelSettingsPanel.add(fontColorField);
		fontColorField.setBounds(150, 90, 80, 25);
		
		fontColorChooseButton.setText("Choose");
		fontColorChooseButton.setFont(new Font("Arial", Font.PLAIN, 11));
		labelSettingsPanel.add(fontColorChooseButton);
		fontColorChooseButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				fontColorActionPerformed(e);
			}
		} );
		fontColorChooseButton.setBounds(70, 90, 73, 25);
                	
        jLabel9.setText("Label Color");
        jLabel9.setFont(new Font("Arial", Font.PLAIN, 11));
        labelSettingsPanel.add(jLabel9);
        jLabel9.setBounds(10, 90, 60, 25);

        getContentPane().add(labelSettingsPanel);
        labelSettingsPanel.setBounds(0, 0, 430, 130);

        //vertices SettingsPanel
        verticesPanel.setLayout(null);
        verticesPanel.setBorder(BorderFactory.createTitledBorder(null, "Vertices Settings", TitledBorder.DEFAULT_JUSTIFICATION,
        		TitledBorder.DEFAULT_POSITION, new Font("Arial", 0, 11)));

        jLabel5.setText("Mark Size");
        jLabel5.setFont(new Font("Arial", 0, 11));
        verticesPanel.add(jLabel5);
        jLabel5.setBounds(10, 20, 50, 25);
        
        markSizeTextField.setText(this.state.getVertexViewState().getMarkSize()+"");
        markSizeTextField.setFont(new Font("Arial", 0, 12));
        verticesPanel.add(markSizeTextField);
        markSizeTextField.setBounds(70, 20, 80, 25);

        jLabel4.setText("Vertices Color");
        jLabel4.setFont(new Font("Arial", 0, 11));
        verticesPanel.add(jLabel4);
        jLabel4.setBounds(190, 20, 70, 25);
        
        verticesColorChooseButton.setText("Choose");
        verticesColorChooseButton.setFont(new Font("Arial", Font.PLAIN, 11));
        verticesPanel.add(verticesColorChooseButton);
		verticesColorChooseButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				verticesColorActionPerformed(e);
			}
		} );
		verticesColorChooseButton.setBounds(260, 20, 73, 25);
        
        verticesColorField.setText("");
        verticesColorField.setEditable(false);
        verticesColorField.setBackground(this.state.getVertexViewState().getMarkColor());
        verticesPanel.add(verticesColorField);
        verticesColorField.setBounds(340, 20, 80, 25);
        
        getContentPane().add(verticesPanel);
        verticesPanel.setBounds(0, 130, 430, 60);

        //verticesStatePanel
        verticesStatePanel.setLayout(null);
        verticesStatePanel.setBorder(BorderFactory.createTitledBorder(null, "State Settings", TitledBorder.DEFAULT_JUSTIFICATION,
        		TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 0, 11)));

        jLabel7.setText("Mark Size");
        jLabel7.setFont(new Font("Arial", Font.PLAIN, 11));
        verticesStatePanel.add(jLabel7);
        jLabel7.setBounds(10, 20, 50, 30);

        markStateSizeTextField.setText(this.state.getVertexViewState().getMarkStateSize()+"");
        markStateSizeTextField.setFont(new Font("Arial", Font.PLAIN, 12));
        verticesStatePanel.add(markStateSizeTextField);
        markStateSizeTextField.setBounds(70, 20, 80, 25);

        jLabel6.setText("Vertices State Color");
        jLabel6.setFont(new Font("Arial", Font.PLAIN, 11));
        verticesStatePanel.add(jLabel6);
        jLabel6.setBounds(160, 20, 100, 25);
        
        verticesStateColorChooseButton.setText("Choose");
        verticesStateColorChooseButton.setFont(new Font("Arial", Font.PLAIN, 11));
        verticesStatePanel.add(verticesStateColorChooseButton);
        verticesStateColorChooseButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				verticesStateColorActionPerformed(e);
			}
		} );
        verticesStateColorChooseButton.setBounds(260, 20, 73, 25);
        
        verticesStateColorField.setText("");
        verticesStateColorField.setEditable(false);
        verticesStateColorField.setBackground(this.state.getVertexViewState().getMarkStateColor());
        verticesStatePanel.add(verticesStateColorField);
        verticesStateColorField.setBounds(340, 20, 80, 25);

        getContentPane().add(verticesStatePanel);
        verticesStatePanel.setBounds(0, 190, 430, 60);
        
        //Setting buttons        
        allWindowsCheckBox.setText("Modify all windows");
        allWindowsCheckBox.setFont(new Font("Arial", 0, 11));
        allWindowsCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        allWindowsCheckBox.setMargin(new Insets(0, 0, 0, 0));
        allWindowsCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(allWindowsCheckBox.isSelected()){
					selectedWindowCheckBox.setSelected(false);
				}else{
					selectedWindowCheckBox.setSelected(true);
				}
			}
		} );
		getContentPane().add(allWindowsCheckBox);
		allWindowsCheckBox.setBounds(10, 250, 120, 25);
		
		selectedWindowCheckBox.setText("Modify selected window");
		selectedWindowCheckBox.setFont(new Font("Arial", 0, 11));
		selectedWindowCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
		selectedWindowCheckBox.setMargin(new Insets(0, 0, 0, 0));
		selectedWindowCheckBox.setSelected(true);
		selectedWindowCheckBox.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(selectedWindowCheckBox.isSelected()){
					allWindowsCheckBox.setSelected(false);
				}else{
					allWindowsCheckBox.setSelected(true);
				}
			}
		} );
		getContentPane().add(selectedWindowCheckBox);
		selectedWindowCheckBox.setBounds(140, 250, 140, 25);

        viewButton.setText("View");
        viewButton.setFont(new Font("Arial",Font.PLAIN,11));
        getContentPane().add(viewButton);
        viewButton.setBounds(10, 290, 70, 25);

        okButton.setText("OK");
        okButton.setFont(new Font("Arial",Font.PLAIN,11));
        getContentPane().add(okButton);
        okButton.setBounds(270, 290, 70, 25);

        cancelButton.setText("Cancel");
        cancelButton.setFont(new Font("Arial",Font.PLAIN,11));
        getContentPane().add(cancelButton);
        cancelButton.setBounds(345, 290, 75, 25);

        viewButton.addActionListener(
				new ActionListener(){
					public void actionPerformed(ActionEvent event){
						approvedPerform();
					}
				});
		
		okButton.addActionListener(
				new ActionListener(){
					public void actionPerformed(ActionEvent event){
						approvedPerform();
						close();
					}
				});
		
		cancelButton.addActionListener(
				new ActionListener(){
					public void actionPerformed(ActionEvent event){
						close();
					}
				});

        
    }// </editor-fold>                        
    
    private void close(){
		this.dispose();
	}
	
	private void approvedPerform(){
		if(allWindowsCheckBox.isSelected()){
			for(int i=0;i<this.desktop.getDesktop().getAllFrames().length;i++){
				if(this.desktop.getDesktop().getAllFrames()[i] instanceof InterfacePostp){
					VertexViewState vertexState = ((PostpViewState)((InterfacePostp)this.desktop.getDesktop().getAllFrames()[i]).getView().getViewState()).getVertexViewState();
					vertexState.setTextFont((String)this.fontComboBox.getSelectedItem());
					vertexState.setTextSize((int)Integer.parseInt((String)this.fontSizeComboBox.getSelectedItem()));
					if(plainRadioButton.isSelected()){
						vertexState.setTextStyle((byte)(Font.PLAIN));
					}
					if(boldRadioButton.isSelected()){
						vertexState.setTextStyle((byte)(Font.BOLD));
					}
					if(italicRadioButton.isSelected()){
						vertexState.setTextStyle((byte)(Font.ITALIC));
					}
					if(boldRadioButton.isSelected()&&italicRadioButton.isSelected()){
						vertexState.setTextStyle((byte)(Font.BOLD+Font.ITALIC));
					}
					vertexState.setLabelColor(this.fontColorField.getBackground());
					
					vertexState.setLabelOn(this.labelOnCheckBox.isSelected());
					vertexState.setLabelOn(!this.labelOffCheckBox.isSelected());
					vertexState.setCoordsOn(this.coordsOnCheckBox.isSelected());
					vertexState.setCoordsOn(!this.coordsOffCheckBox.isSelected());
					
					
					vertexState.setMarkSize(Integer.parseInt(this.markSizeTextField.getText()));
					vertexState.setMarkColor(this.verticesColorField.getBackground());
					vertexState.setMarkStateSize(Integer.parseInt(this.markStateSizeTextField.getText()));
					vertexState.setMarkStateColor(this.verticesStateColorField.getBackground());
					
					((InterfacePostp)((DesktopPostp)this.desktop).getDesktop().getAllFrames()[i]).getView().getDrawingArea().repaint();
					this.desktop.repaint();
					
				}
			}
			
		}else if(selectedWindowCheckBox.isSelected()){
			VertexViewState vertexState = ((PostpViewState)((InterfacePostp)this.desktop.getDesktop().getSelectedFrame()).getView().getViewState()).getVertexViewState();
			vertexState.setTextFont((String)this.fontComboBox.getSelectedItem());
			vertexState.setTextSize((int)Integer.parseInt((String)this.fontSizeComboBox.getSelectedItem()));
			if(plainRadioButton.isSelected()){
				vertexState.setTextStyle((byte)(Font.PLAIN));
			}
			if(boldRadioButton.isSelected()){
				vertexState.setTextStyle((byte)(Font.BOLD));
			}
			if(italicRadioButton.isSelected()){
				vertexState.setTextStyle((byte)(Font.ITALIC));
			}
			if(boldRadioButton.isSelected()&&italicRadioButton.isSelected()){
				vertexState.setTextStyle((byte)(Font.BOLD+Font.ITALIC));
			}
			vertexState.setLabelColor(this.fontColorField.getBackground());
			
			vertexState.setLabelOn(this.labelOnCheckBox.isSelected());
			vertexState.setLabelOn(!this.labelOffCheckBox.isSelected());
			vertexState.setCoordsOn(this.coordsOnCheckBox.isSelected());
			vertexState.setCoordsOn(!this.coordsOffCheckBox.isSelected());
			
			vertexState.setMarkSize(Integer.parseInt(this.markSizeTextField.getText()));
			vertexState.setMarkColor(this.verticesColorField.getBackground());
			vertexState.setMarkStateSize(Integer.parseInt(this.markStateSizeTextField.getText()));
			vertexState.setMarkStateColor(this.verticesStateColorField.getBackground());
		
			((InterfacePostp)((DesktopPostp)this.desktop).getDesktop().getSelectedFrame()).getView().getDrawingArea().repaint();
			this.desktop.repaint();
			
		}
		
	}
    
	private void fontColorActionPerformed(ActionEvent e) {
		fontColorField.setBackground(JColorChooser.showDialog(this, "Choose Label Color", fontColorField.getBackground()));
	}
	
	private void verticesColorActionPerformed(ActionEvent e) {
		verticesColorField.setBackground(JColorChooser.showDialog(this, "Choose Label Color", verticesColorField.getBackground()));
	}
	
	private void verticesStateColorActionPerformed(ActionEvent e) {
		verticesStateColorField.setBackground(JColorChooser.showDialog(this, "Choose Label Color", verticesStateColorField.getBackground()));
	}
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VerticesSettingsDialog(new javax.swing.JFrame(), true).setVisible(true);
            }
        });
    }

	public DesktopPostp getDesktop() {
		return desktop;
	}

	public void setDesktop(DesktopPostp desktop) {
		this.desktop = desktop;
	}
    
    
//************************************************************************************************************************
}//end of this class
